package com.jcl.recruit.searchresume;

import com.jcl.core.db.DatabaseContext;
import com.jcl.recruit.searchresume.mapper.SearchResumeRecordMapper;
import com.jcl.recruit.searchresume.model.SearchResumeRecord;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @ClassName SearchResumeRecordDao

 * @Author yyliu
 * @Date 2018/12/20 16:05
 * @Version 1.0
 **/
@Component
public class SearchResumeRecordDao implements SearchResumeRecordMapper {

    @Autowired
    private SearchResumeRecordMapper searchResumeRecordMapper;


    @Override
    public List<SearchResumeRecord> findList(String corpCode,
                                             Integer userId,
                                             Integer status,
                                             Integer wechatPush,
                                             Integer emailPush) {
        DatabaseContext.setContext(corpCode);
        return searchResumeRecordMapper.findList(corpCode, userId, status, wechatPush, emailPush);
    }

    @Override
    public List<SearchResumeRecord> findListByCondition(String corpCode,
                                                        Integer userId,
                                                        String keyword,
                                                        String city,
                                                        String education,
                                                        Integer workYear,
                                                        Integer wechatPush,
                                                        Integer emailPush) {
        DatabaseContext.setContext(corpCode);
        return searchResumeRecordMapper.findListByCondition(corpCode, userId,
                keyword, city, education, workYear, wechatPush, emailPush);
    }

    @Override
    public List<SearchResumeRecord> findListByKeyword(String corpCode, String keyword) {
        DatabaseContext.setContext(corpCode);
        return searchResumeRecordMapper.findListByKeyword(corpCode, keyword);
    }

    @Override
    public SearchResumeRecord findOne(String corpCode, Integer id) {
        DatabaseContext.setContext(corpCode);
        return searchResumeRecordMapper.findOne(corpCode, id);
    }

    @Override
    public int insert(SearchResumeRecord record) {
        DatabaseContext.setContext(record.getCorpCode());
        return searchResumeRecordMapper.insert(record);
    }

    @Override
    public int update(SearchResumeRecord record) {
        DatabaseContext.setContext(record.getCorpCode());
        return searchResumeRecordMapper.update(record);
    }

    @Override
    public int deleteById(String corpCode, Integer id) {
        DatabaseContext.setContext(corpCode);
        return searchResumeRecordMapper.deleteById(corpCode, id);
    }
}
